package conversion

import (
	"gitee.com/xntk2381/cc/vm/module"
)

type D2LCommand struct{}

func (D2LCommand) Execute(parts []string, currentPC int, operandStack *module.OperandStack, localVariableStore *module.LocalVariableStore, callStack *module.CallStack) (int, error) {
	val, err := operandStack.Pop()
	if err != nil {
		return 0, err
	}
	convertedValue := int64(val.(float64))
	operandStack.Push(convertedValue)
	return currentPC + 1, nil
}
